<?php 
if($session->check('Auth.User.id')){
	if($session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'manag')
	echo $this->element('toolbar',array('plugin' => 'gallery','category_id'=>$category_id));
}
?>


<?php 
$this->Html->styleBlock("
	dl.gallery { position: relative;}
	dl.gallery dt { display: inline; margin: {$params['margin']}px; z-index: 90; width: ".($params['width']+10)."px; height: ".($params['height']+10)."px;  text-align: center; float: left;}
	dl.gallery dt a.highslide { display: block; width: ".($params['width']+10)."px; height: ".($params['height']+10)."px; padding: {$params['padding']}px;  border: solid {$params['border']}px #eee; background-position: center; background-repeat: no-repeat; float: left; overflow: hidden;}
	dl.gallery dt a.highslide:hover { padding: {$params['padding']}px;  }
",array('inline'=>false));
?>
<?php 
if($session->check('Auth.User.id')){
	if($session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'manag')
	$this->Html->styleBlock("
		ul.file_toolbar { display: block; position: absolute; background: url(../../img/firma/bg_toolbar.png) repeat; margin: ".($params['border']+3)."px;  z-index: 1000; float: none; }
		ul.file_toolbar li { display: block; float: left; width: 16px; height: 16px; margin: 3px; padding: 2px; background: url(../../img/firma/bg_toolbar.png) repeat; }
		ul.file_toolbar li a { display: block; padding: 0px; margin: 0px; width: 16px; height: 16px; }
		ul.file_toolbar li a img { padding: 0px; margin: 0px;  }
		ul.file_toolbar li:hover { background: #fff; }
	",array('inline'=>false));
}?>

<?php if(is_array($items) && !empty($items)){?>
<dl class="gallery clearfix">
<?php foreach ($items as $key => $photo) {?>
<dt>	
	<?php 
		if($session->check('Auth.User.id')){
			if($session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'manag')
			echo $this->element('file_toolbar',array('plugin' => 'gallery','category_id'=>$category_id,'gallery_id'=>$photo['Gallery']['id']));
		}
		
	?>
	<?php
		$file = $fileUpload->image($photo['Upload']['name'],array('autoResize'=>false,'imagePathOnly'=>true));
		$ext = strtolower($fileUpload->_getExt());
		 
		if($ext == '.jpg' || $ext == '.jpeg'  || $ext == '.gif' || $ext == '.png' || $ext == '.bmp'){
			
	?>
	<a href="<?php echo $file?>" title="<?php echo $photo['Gallery']['name']?>" style="background: url(<?php echo str_replace(' ',"%20",$fileUpload->image($photo['Upload']['name'],array('autoResize'=>true,'width'=>$params['width'],'imagePathOnly'=>true)));?>) center no-repeat; "  class="highslide"  onclick="return hs.expand(this)"></a>
	<?php }else{?>
	<?php 
		if($ext == '.mov' || $ext == '.swf'  || $ext == '.flv' || $ext == '.avi' || $ext == '.mpg' || $ext == '.mpeg'){
			$rel = 'rel="prettyPhoto[gallery]"';
		}else{
			$rel = '';
		}
	?>
	<a href="<?php echo $file;?>" title="<?php echo $photo['Gallery']['name']?>" <?php echo $rel?> style="background: #fff; vertical-align: middle; "><br/><br/><?php echo '( '. $photo['Upload']['name'].' ) <br/><br/> <span style="text-decoration: none;  font-weight: normal;"  class="highslide"  onclick="return hs.expand(this)">'. $photo['Gallery']['name'].'</span>';?></a>
	<?php }?>	
</dt>
<?php }?>
</dl>
<?php }?>

